import java.io.*;
public class MyCP
{
    public static void dump1(InputStream src, OutputStream dest)
            throws IOException {
        try (InputStream input = src; OutputStream output = dest) {
            byte[] data = new byte[1];//每次读取一字节
            int length;
            while ((length = input.read(data)) != -1) {
                String str = Integer.toBinaryString((data[0]&0xFF)+0x100).substring(1);
                data[0] = Byte.parseByte(str);
                output.write(data, 0, length);
            }
        }
    }
    public static void dump2(InputStream src, OutputStream dest)
            throws IOException {
        try (InputStream input = src; OutputStream output = dest) {
            byte[] data = new byte[1];
            int length;
            while ((length = input.read(data)) != -1) {
                data[0] = Byte.parseByte(String.valueOf(data[0]),10);//使用Byte.parseByte()实现二进制转换为十进制
                output.write(data, 0, length);
            }
        }
    }
    public static void main(String[] args) {
        FileInputStream in = null;
        FileOutputStream out = null;
        try {
            in = new FileInputStream("D:\\杨笛\\大二下\\exp5\\src\\temp.bin");
            out = new FileOutputStream("D:\\杨笛\\大二下\\exp5\\src\\temp.txt");
            dump2(in, out);
        }catch(Exception e) {
            System.out.println(e);
        }
    }
}